﻿@using Microsoft.AspNetCore.Components.Web
@implements IDisposable
@inject Blazor.ModalDialog.IModalDialogService DialogService

@foreach (Blazor.ModalDialog.ModalDialogModel modalDialogEntry in DialogService.ModalDialogFrames.Reverse())
{
    <ModalDialogFrameView @key="modalDialogEntry"
                          Title="@modalDialogEntry.Title"
                          ModalDialogEntry="@modalDialogEntry"/>
}

@code {
    protected override void OnInitialized()
    {
        DialogService.Changed += StateHasChanged;
    }

    public void Dispose()
    {
        DialogService.Changed -= StateHasChanged;
    }
}
